<template>
  <div class="applicationAssessment">
    <p class="bottons">
      <el-button @click="submitH3" type="text">
        <i class="el-icon-document"></i>提交H3审批
      </el-button>
      <el-button @click="cancelAdopt" type="text">
        <i class="el-icon-close"></i>取消通过
      </el-button>
    </p>
    <h1>结佣付款申请审批</h1>
    <table>
      <tr class="tableTitle">
        <td colspan="4">基本信息</td>
      </tr>
      <tr>
        <td>发起人</td>
        <td>{{userName}}</td>
        <td>发起时间</td>
        <td></td>
      </tr>
      <tr>
        <td>发起组织名称</td>
        <td>{{info.paymentName}}</td>
        <td>付款审批单号</td>
        <td></td>
      </tr>
      <tr>
        <td>付款审批名称</td>
        <td colspan="3">{{info.remark}}</td>
      </tr>
      <tr class="tableTitle">
        <td colspan="4">付款审批概述</td>
      </tr>
      <tr>
        <td>审批事项</td>
        <td>{{approvalMatter}}</td>
        <td>付款类型</td>
        <td>{{paymentType}}</td>
      </tr>
      <tr>
        <td>前置条件</td>
        <td colspan="3">开发商返还款：1.开发商确认函； 2.发票或其他合法票据或发票欠收单； 3.合作协议</td>
      </tr>
      <tr>
        <td>流程事项编码</td>
        <td colspan="3">hsh_yg_return{{approvalMatter}}</td>
      </tr>
      <tr>
        <td>付款方</td>
        <td>{{info.paymentName}}</td>
        <td>收款方</td>
        <td>{{info.receiveName}}</td>
      </tr>
      <tr>
        <td>付款方开户支行</td>
        <td>{{info.paymentBankBranch}}</td>
        <td>收款方开户支行</td>
        <td>{{info.receiveBankBranch}}</td>
      </tr>
      <tr>
        <td>付款账号</td>
        <td>{{info.paymentAccount}}</td>
        <td>收款账号</td>
        <td>{{info.receiveAccount}}</td>
      </tr>
      <tr>
        <td>本次请款含税金额</td>
        <td>{{info.payAmount}}</td>
        <td>批复含税金额</td>
        <td>{{info.payAmount}}</td>
      </tr>
      <tr>
        <td>票据方式</td>
        <td>{{billType}}</td>
        <td>计税方式</td>
        <td>{{info.taxType == 1 ? '一般' : '简易'}}</td>
      </tr>
      <tr>
        <td>经办人</td>
        <td>{{userName}}</td>
        <td>联系电话</td>
        <td>{{personMobile}}</td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      info: {},
      person: "" // 发起人
    };
  },
  computed: {
    userName() {
      let name = JSON.parse(window.localStorage.getItem("cmsUser")).name;
      
      return name;
    },
    personMobile() {
      let mobile = JSON.parse(window.localStorage.getItem("cmsUser")).mobile;
      return mobile;
    },
    paymentType() {
      if (this.info.paymentType == 1) {
        return "通过银企直连付款（对公）";
      } else if (this.info.paymentType == 2) {
        return "通过银企直连付款（对私）";
      } else {
        return "转账";
      }
    },
    billType() {
      if (this.info.billType === 1) {
        return "增值税专用发票";
      } else if(this.info.billType === 2){
        return "普通发票";
      }else {
        return ''
      }
    },
    approvalMatter() {
      if(this.info.projectClassify == 5) {
        if(0 < this.info.realAmount < 1000000) {
          return '0万 < 金额 ≤ 100万（珠江）'
        } else if(1000000 < this.info.realAmount < 2000000) {
          return '100万 < 金额 ≤ 200万（珠江）'
        }else if(2000000 < this.info.realAmount < 5000000) {
          return '200万 < 金额 ≤ 500万（珠江）'
        }else if(5000000 < this.info.realAmount) {
          return '500万 < 金额 （珠江）'
        }
      }else {
        if(0 < this.info.realAmount < 1000000) {
          return '0万 < 金额 ≤ 100万（非珠江）'
        } else if(1000000 < this.info.realAmount < 2000000) {
          return '100万 < 金额 ≤ 200万（非珠江）'
        }else if(2000000 < this.info.realAmount < 5000000) {
          return '200万 < 金额 ≤ 500万（非珠江）'
        }else if(5000000 < this.info.realAmount) {
          return '500万 < 金额 （非珠江）'
        }
      }
    }
  },
  created() {
    this.info = JSON.parse(window.localStorage.getItem("form"));
    console.log(this.info);
  },
  methods: {
    submitH3() {
      this.info.createTime = new Date().getTime();
      this.$axios.post("/commission/developer/add", this.info).then(res => {
        this.$message({
          type: "success",
          message: "操作成功"
        });
        this.$router.push('./developerPayment');
      });
    },
    // 取消通过
    cancelAdopt() {
      this.$router.push("./addPayment");
    }
  }
};
</script>

<style lang="stylus" scoped>
.applicationAssessment {
  position: relative;

  h1 {
    color: #409eff;
    margin: 35px auto;
    text-align: center;
  }

  .bottons {
    position: absolute;
    right: 35px;
    top: 5px;

    i {
      margin-right: 5px;
    }

    el-button {
      margin-right: 15px;
    }
  }

  table {
    font-size: 15px;
    border-collapse: collapse;
    width: 100%;
    margin: 0 auto;

    tr td {
      border: 1px solid #ccc;
      line-height: 40px;
      box-sizing: border-box;
      padding: 0 3px;
      text-align: center;
      width: 25%;
    }

    tr td:nth-child(odd) {
      text-align: right;
      color: #409eff;
    }

    tr td:nth-child(even) {
      text-align: left;
    }

    .tableTitle td {
      text-align: center !important;
      background: #f2f2f2;
      color: #409eff;
      font-weight: bold;
    }

    pre {
      font-family: 'Avenir', Helvetica, Arial, sans-serif;
    }

    .approval span {
      margin-left: 15px;
    }
  }
}
</style>